<?php

namespace App\Admin\Forms\Tenant;

use App\Wen\Utils\FieldUtils;
use App\Wen\Utils\Settings;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;

class PayModelCodeForm1 extends Form implements LazyRenderable
{
    use LazyWidget;

    public function handle(array $input)
    {
        for ($i = 1; $i <= 10; $i++){
            if(isset($input['mini_pay_code_'.$i])){
                Settings::set('mini_pay_code_'.$i, $input['mini_pay_code_'.$i], true);
            }
        }

        return $this->response()
            ->success('配置成功')
            ->refresh();
    }

    public function form()
    {
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费1：模糊搜索、搜索高亮</div>';
            }, '');
            $this->image('mini_pay_code_1', '付费1')->help('<a href="https://img.mini.minisns.cn/2023/05/06/3a8150e0c552f7b5649932339da1ca1b.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_1', 'https://img.mini.minisns.cn/2023/05/06/3a8150e0c552f7b5649932339da1ca1b.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费2：服务号模板消息+小程序订阅消息</div>';
            }, '');
            $this->image('mini_pay_code_2', '付费2')->help('<a href="https://img.mini.minisns.cn/2023/05/04/ec15503cbea2075128b81c2ab98b64fe.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_2', 'https://img.mini.minisns.cn/2023/05/04/ec15503cbea2075128b81c2ab98b64fe.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费3：附件自动清理</div>';
            }, '');
            $this->image('mini_pay_code_3', '付费3')->help('<a href="https://img.mini.minisns.cn/2023/05/06/271945d1229c94c4f16f850b9b8bb0bf.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_3', 'https://img.mini.minisns.cn/2023/05/06/271945d1229c94c4f16f850b9b8bb0bf.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费4：文字内容审核</div>';
            }, '');
            $this->image('mini_pay_code_4', '付费4')->help('<a href="https://img.mini.minisns.cn/2023/05/06/29200f83e9019f1b3c5bbdcd779040b9.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_4', 'https://img.mini.minisns.cn/2023/05/06/29200f83e9019f1b3c5bbdcd779040b9.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费5：首页内容弱算法排序</div>';
            }, '');
            $this->image('mini_pay_code_5', '付费5')->help('<a href="https://img.mini.minisns.cn/2023/05/06/0c3c850b2b97a9cb035a14bd772e1deb.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_5', 'https://img.mini.minisns.cn/2023/05/06/0c3c850b2b97a9cb035a14bd772e1deb.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费6：websocket在线即时通知</div>';
            }, '');
            $this->image('mini_pay_code_6', '付费6')->help('<a href="https://img.mini.minisns.cn/2023/05/06/cc056fa268fb069885db46cfde03c00b.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_6', 'https://img.mini.minisns.cn/2023/05/06/cc056fa268fb069885db46cfde03c00b.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费7：余额付费贴，附件付费贴</div>';
            }, '');
            $this->image('mini_pay_code_7', '付费7')->help('<a href="https://img.mini.minisns.cn/2023/05/06/3b4bf890baf838241e06013d4773a83d.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_7', 'https://img.mini.minisns.cn/2023/05/06/3b4bf890baf838241e06013d4773a83d.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费8：页面模板</div>';
            }, '');
            $this->image('mini_pay_code_8', '付费8')->help('<a href="https://img.mini.minisns.cn/2023/05/06/2b44259261a4ecdfc014124442061e4e.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_8', 'https://img.mini.minisns.cn/2023/05/06/2b44259261a4ecdfc014124442061e4e.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费9：活跃系统</div>';
            }, '');
            $this->image('mini_pay_code_9', '付费9')->help('<a href="https://img.mini.minisns.cn/2023/05/06/2b3b4497a3197e8552f61e93ae902fee.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_9', 'https://img.mini.minisns.cn/2023/05/06/2b3b4497a3197e8552f61e93ae902fee.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费10：seo额外支持</div>';
            }, '');
            $this->image('mini_pay_code_10', '付费10')->help('<a href="https://img.mini.minisns.cn/2023/05/06/fbea86d62bb267c9a3b501010f1f5c19.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_10', 'https://img.mini.minisns.cn/2023/05/06/fbea86d62bb267c9a3b501010f1f5c19.jpg'));
    }
}
